
!include "MUI2.nsh"

Name "ColorTool Installer"
OutFile "ColorTool-installer-1.0.exe"

InstallDir "$PROGRAMFILES\ColorTool"

RequestExecutionLevel user

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp" ;
!define MUI_ABORTWARNING

!insertmacro MUI_PAGE_LICENSE "C:\colortool-1.0\gpl-2.0.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"

Section "Dummy Section" SecDummy
  SetOutPath $INSTDIR
  File C:\colortool-1.0\release\ColorTool.exe
  File C:\colortool-1.0\gpl-2.0.txt
  SetOutPath $INSTDIR\translations
  File C:\colortool-1.0\lang\*.qm
  WriteUninstaller $INSTDIR\UnInstall.exe
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ColorTool" "DisplayName" "ColorTool Installer"
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ColorTool" "UninstallString" '"$INSTDIR\UnInstall.exe"'
  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ColorTool" "NoModify" 1
  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ColorTool" "NoRepair" 1
SectionEnd

Section "Start Menu Shortcuts"
  CreateDirectory "$SMPROGRAMS\ColorTool"
  CreateShortCut "$SMPROGRAMS\ColorTool\UnInstall.lnk" "$INSTDIR\UnInstall.exe" "" "$INSTDIR\UnInstall.exe" 0
  CreateShortCut "$SMPROGRAMS\ColorTool\ColorTool.lnk" "$INSTDIR\ColorTool.exe" "" "$INSTDIR\ColorTool.exe" 0
SectionEnd

Section "Uninstall"
  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ColorTool"
  Delete $INSTDIR\ColorTool.exe
  Delete $INSTDIR\gpl-2.0.txt
  Delete $INSTDIR\UnInstall.exe
  Delete $INSTDIR\translations\*.qm
  Delete "$SMPROGRAMS\ColorTool\ColorTool.lnk" 
  Delete "$SMPROGRAMS\ColorTool\UnInstall.lnk"
  RMDir "$SMPROGRAMS\ColorTool" 
  RMDir $INSTDIR\translations
  RMDir $INSTDIR
SectionEnd
